﻿CREATE proc editquyen_capnhatquyentrenmenu    
@ID int,    
@CapNhat int,    
@Xem int,    
@Xoa int    
as    
declare @CapNhatKT int  
declare @XemKT int 
declare @XoaKT int  
select top 1 @CapNhatKT=Quyen_CapNhat,@XemKT=Quyen_Xem,@XoaKT=Quyen_Xoa from QuanTri_PhanNhomMenu Where 
ID in (select IDPhanNhomMenu from QuanTri_EditUserRoleInGroup Where ID=@ID)
if(@CapNhatKT=0)
begin
set @CapNhat=0
end

if(@XemKT=0)
begin
set @Xem=0
end

if(@XoaKT=0)
begin
set @Xoa=0
end




update QuanTri_EditUserRoleInGroup set    
Quyen_CapNhat=@CapNhat,Quyen_Xem=@Xem,Quyen_Xoa=@Xoa    
Where ID=@ID    
select ErrCode=1